#include <iostream>
#include <netdb.h>
#include <netinet/in.h>
#include <unistd.h>

#include "log.hpp"
#include "fstring.hpp"
#include "prompt.hpp"

#define BUFFSIZE 512

using namespace std;

class Client : public Prompt
{
	public:
		Client(const char* adresse);
		~Client();

		void start();
		void stop();

		void update();

		bool isConnected();

	private:

		bool activate;
		char buff[512];


		int dport;
		int socketDesc;
		fd_set toListen;

		char* addressServer;
		sockaddr_in serverAddress;
		hostent *hostInfo;

		bool connected;

		void runLoop();
		void stdinHandler();
		void dataHandler();


		FString sendAndWait(FString request);
};
